package cn.edu.scau.cmi.yangqing.singleton;

import java.net.URL;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;

public class MyController implements Initializable {

	   @FXML
	   private Button myButton;

	   @FXML
	   private TextField myTextField;

	   @FXML
	   private TextField myTextField2;
	   public void initialize(URL location, ResourceBundle resources) {

	   }

	   public void showDateTime(ActionEvent event) {
	       System.out.println("Button Clicked!");

	       String field = myTextField.getText();
	       
	       Chairman chairman = Chairman.getInstance(field);
		   System.out.println("输入的主席为："+field + "  现在的主席是："+chairman.getName());
			
		   Date now= new Date();
	       DateFormat df = new SimpleDateFormat("dd-MM HH:mm:ss");
	       String dateTimeString = "时间为："+df.format(now)+"\n";
		   
	       myTextField2.setText(dateTimeString + "  现在的主席是："+chairman.getName());
	       
	   }
}
